import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

type CusRouteRecordRaw = RouteRecordRaw & {
  cmpName: string
}

const routes: CusRouteRecordRaw[] = [
  {
    cmpName: '主页',
    path: '/',
    name: 'HomeView',
    component: HomeView,
  },
  {
    cmpName: '关于',
    path: '/AboutView',
    name: 'AboutView',
    component: () => import('../views/AboutView.vue'),
  },
  {
    cmpName: '表格跨行-示例',
    path: '/rowSpanning',
    name: 'rowSpanning',
    component: () => import('../views/RowSpan.vue'),
  },
  {
    cmpName: '表格跨行-大数据量',
    path: '/agGrid',
    name: 'agGrid',
    component: () => import('../views/RowSpanLargeData.vue'),
  },
  {
    cmpName: '自定义组件',
    path: '/cusCmp',
    name: 'cusCmp',
    component: () => import('../views/CusCmpView.vue'),
  },
  {
    cmpName: '自定义组件A',
    path: '/cusCmpA',
    name: 'cusCmpA',
    component: () => import('../views/CusCmpAView.vue'),
  },
  {
    cmpName: '自定义编辑组件',
    path: '/cusEditor',
    name: 'cusEditor',
    component: () => import('../views/CusEditorView.vue'),
  },
  {
    cmpName: '自定义编辑组件A',
    path: '/cusEditorA',
    name: 'cusEditorA',
    component: () => import('../views/CusEditorAView.vue'),
  },
  {
    cmpName: '编辑验证',
    path: '/editorValid',
    name: 'editorValid',
    component: () => import('../views/EditorValidView.vue'),
  },
  {
    cmpName: '编辑状态',
    path: '/editorState',
    name: 'editorState',
    component: () => import('../views/EditorStateView.vue'),
  },
  {
    cmpName: '上下文菜单',
    path: '/contextMenu',
    name: 'contextMenu',
    component: () => import('../views/ContextMenuView.vue'),
  },
  {
    cmpName: '事件测试',
    path: '/Event',
    name: 'Event',
    component: () => import('../views/EventView.vue'),
  },
  {
    cmpName: '列全局设置',
    path: '/ColGlobalSetView',
    name: 'ColGlobalSetView',
    component: () => import('../views/ColGlobalSetView.vue'),
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routes,
})

export default router

export { routes }
